package com.fang.牛客;
import java.util.Scanner;
public class Demo2 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int beginPosition = 0;
        int orderNum = in.nextInt();
        int luckyNum = in.nextInt();

        int max = beginPosition;
        for (int i = 0; i < orderNum; i++) {
            int num = in.nextInt();
            beginPosition += num;
            if (num == luckyNum && luckyNum < 0) {
                beginPosition -= 1;
            } else if (num == luckyNum && luckyNum >= 0) {
                beginPosition += 1;
            }
            max = Math.max(max, beginPosition);
        }
        System.out.println(max);
    }
}
